Skip to content

fix(gsa): leave out a parameter the reader never filled in, and record why the emails vanish - #237

Merged
adamjohnwright merged 2 commits into
mainfrom
fix/gsa-omit-unset-parameters
Sep 18, 2026
Merged

adamjohnwright merged 2 commits into
mainfrom
fix/gsa-omit-unset-parameters

Conversation

@adamjohnwright

@adamjohnwright adamjohnwright commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Found while establishing whose job the missing report emails in #168 are.

Read the correction first — the reasoning in my original description was wrong.

Who sends the mail

Not us. The address is a GSA method parameter; reactome/gsa-backend sends. There
is no SMTP, no mailer and no send anywhere in this repository.

Our submission path is otherwise correct, which I checked rather than assumed:
parameters are split into method-specific and common in the reducer, email is
common, and the obvious failure would be common parameters never reaching the
request. They do reach it.

Correction: the "undefined" case cannot happen

I originally claimed an unfilled email was submitted as the string
"undefined", because submitQuery maps every parameter through param.value + ''.

That is wrong. reactome_analysis_api/methods.py declares all 15 parameters
with a default, and email's is the empty string:

MethodParameters(name="email", display_name="E-Mail", type="string",
                 scope="common", default="", ...)

Our form seeds value: param.default, so an untouched email is "", and
"" + '' is "". param.value is never undefined by that path.

Production has identical code. From https://reactome.org/gsa/:

parameters: i.map(s => ({ name: s.name, value: s.value + "" })) || []

Character for character ours — expected, since this was absorbed from
reactome/gsa-frontend, which is what production serves. So this is not a
regression in the rewrite.

Why the emails actually vanish

reactome_analysis_worker.py queues a report when reports were asked for or
the address is longer than three characters, and passes the address either way:

if request.parameter_dict.get("create_reports", "False").lower() == "true" or \
   len(request.parameter_dict.get("email", "")) > 3:
    ReportRequest(..., user_mail=request.parameter_dict.get("email", None), ...)

then reactome_analysis_report_generator.py:

# send the e-mail if set
if request.user_mail:
    ...send_email(...)

"" is falsy. Reports are generated, the mail is skipped, and nothing tells the
reader.
That is exactly "reports actually seem ok but they weren't emailed".

What this PR is, honestly

Omitting valueless parameters is equivalent to the old behaviour from the
backend's point of view — the worker's .get("email", "") treats absent and empty
identically. So this fixes no bug. It is worth keeping because sending "" and
"undefined" for things nobody filled in is nonsense to put on the wire, and
false/0 are answers and are kept — but it is tidying, not a fix, and the
original description overclaimed.

against the old behaviour:  2 failed | 2 passed
with the fix:               4 passed

The question that would actually settle #168

Did the curator's address ever reach the request? Nothing on our side checks
the box was filled, Parameter.required is declared and never enforced, and
len > 3 makes empty and absent indistinguishable. That is answerable from GSA's
logs and not from here.

Also carries specs/003 and specs/004, recording today's decisions in the shape
002 established.

Refs #168.

🤖 Generated with Claude Code

adamjohnwright and others added 2 commits September 18, 2026 01:50
`submitQuery` mapped every parameter through `param.value + ''`. A parameter
seeded from an absent `default` has `value: undefined`, and `undefined + ''` is
the **string** `"undefined"` -- so an unfilled email was submitted as an address,
and the analysis service was asked to deliver a report somewhere that cannot
exist. Reports arrive, no mail does, and nothing anywhere says why.

Found while establishing whose job the missing emails in #168 are. Delivery is
GSA's -- there is no mailer in this repository -- and our submission path is
otherwise correct: common parameters really are merged into the request, which was
the obvious suspect and is not the problem.

Unset parameters are now omitted. `false` and `0` are answers and are kept; only
`undefined`, `null` and the empty string are absent.

The rule is extracted and unit tested rather than driven through the service,
which needs a store, an HttpClient and a config provider to construct -- none of
which have anything to do with the decision. Proven to discriminate:

    against the old behaviour: 2 failed | 2 passed
    with the fix:              4 passed

The two that pass either way are `false` and `0`, so they guard against
over-filtering rather than restating the fix.

This may or may not be what the curator hit; their address may have reached GSA
perfectly well. That question belongs to GSA's logs, and asking is cheaper than
submitting analyses to reproduce it.

Refs #168.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Two new records, in the shape 002 established: decision, why, what was rejected,
and the measurement that settled it.

**003 — the recorded backend for e2e tests.** Why tests replay recordings rather
than calling a server, and the six decisions inside that: one recording per test
rather than per spec (per-spec lost 13 of 18 entries in one file and all 9 in
another), matching without the origin, recording the probe requests that were
silently skipping fourteen tests, why the shared fallback is GET and HEAD only,
why the release suite is never recorded, and what the trim keeps.

**004 — how the site is built and served.** nginx replacing Apache and the
CLOSE-WAIT measurement behind it, per-upstream keepalive from measured backend
timeouts, moving nginx's config out of the git tree, Node 24, dropping
`--legacy-peer-deps` by moving vitest, keeping the reader's selection when
navigating, and omitting GSA parameters with no value.

Both carry the figures rather than the conclusions, including two I got wrong
first: that serial recording would fix the overwrite, and that dropping
`--legacy-peer-deps` cost 207 version changes. Recorded as rejected options with
the reason, because a wrong number that travelled for a day is worth writing down
once.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@adamjohnwright adamjohnwright changed the title fix(gsa): leave out a parameter the reader never filled in fix(gsa): leave out a parameter the reader never filled in, and record why the emails vanish Sep 18, 2026
@adamjohnwright
adamjohnwright merged commit 3d62c01 into main Sep 18, 2026
6 checks passed
@adamjohnwright
adamjohnwright deleted the fix/gsa-omit-unset-parameters branch September 18, 2026 02:10
adamjohnwright added a commit that referenced this pull request Sep 18, 2026
…ed (#242)

* fix(gsa): stop submitting an address the form already knows is malformed

Typing `adam@` into the E-Mail field on the options step submitted the
analysis with that address, and no mail ever arrived. The form had already
decided the value was invalid; it just never acted on it or said so.

Two causes, both from the validator and the template identifying the field
differently. The validator asked `type === 'email' || name.includes('email')`;
the template switched on `type` alone. GSAServer sends the address as
`type: "string"`, so the validator attached and the template rendered the
plain-string branch -- which carries no `mat-error`. The message that would
have explained the red field sat in a branch that never rendered, and nothing
read `invalid` before the stepper advanced.

Both now go through `isEmailParameter`, and the options step's Continue button
is gated on every parameter being valid.

The gate does not use `control` for validity. `control` updates on blur, which
is too late to gate a button: clicking Continue blurs the input, so the blur
and the click race, and in a zoneless app the re-render loses -- the click
would land on a still-enabled button. A separate probe validates on each
keystroke, so the field is marked and Continue disabled before any click.

Deliberately not fixed by dropping the value in `submittedParameters()`
alongside the blank one (#237). Silently discarding a typo'd address is worse
than sending it, because the reader is left expecting mail.

Blank addresses are unchanged and correct: omitted from the request since
#237, and optional by the server's own description of the parameter. The
server half of the missing-report-emails problem remains #168.

The new spec covers the cause -- the type/name disagreement -- against the
recorded payload, and was confirmed red against the old type-only predicate.
The rendering is not covered: this component has an external templateUrl,
which the vitest setup cannot compile.

Refs #241

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(curators): correct the analysis-email note, which described a closed issue

The note told curators we do not enforce the address and pointed at #238. #238
is closed as invalid -- `required` is never sent by GSAServer, so the remedy it
proposed was a no-op, and the blank-address half it described was already fixed
in #237.

What is worth telling them is the opposite of what the note said: a blank
address is fine and always was, and a *mistyped* one was the trap. Both now
described as they actually behave.

RELEASE-TESTING.md gains a manual row for the rendered message, with the reason
it is manual rather than auto.

Refs #241

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant